package com.wyg.epuser.config.apo;

import com.wyg.epcommonbase.common.util.AssertUtil;
import com.wyg.epuser.utils.RequestUtil;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @Author: WangYongGan
 * @Date: 2022/3/2 1:13
 * @Description:
 */
@Component
@Aspect
public class LoginAop {
    @Pointcut("@annotation(com.wyg.epcommonbase.common.annotation.Login)")
    public void pointCut() {
    }

    @Before("pointCut()")
    public void before(JoinPoint joinPoint) {
        AssertUtil.isTrue(!RequestUtil.logined(), 108, "请登录");
        joinPoint.getTarget();
    }
}
